package oj;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 郝文雪
 * @date 2022/8/25 16:20
 * @Description Test
 */
public class LC230 {
    List<Integer> list=new ArrayList<>();
    public int kthSmallest(TreeNode root, int k) {
        if(root==null || k==0) return 0;
        inorder(root);
        return list.get(k-1);
    }
    private void inorder(TreeNode root){
        if(root.left!=null){
            inorder(root.left);
        }
        list.add(root.val);
        if(root.right!=null){
            inorder(root.right);
        }
    }
}
